﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Net;
using System.Collections;
using System.Xml;
using System.Linq;
//using System.Xml.Linq;

using CommonUtils;
using TDAL = EzDAL.Auto2;
using TDALUtils = EzDAL.Utils;
using TConst = TERP.Constants;
using TUtils = TERP.Utils;
using TError = TERP.Errors;


namespace TERP.BizITS
{
    public partial class BizWater
	{
		#region // Private Utils:
		#endregion

        #region //Validate

        #region //BookGuide
        #region //CheckExistCusID
		private void CheckExistCusID(
           ref ArrayList alParamsCoupleError
           , string strCusID
           , out DataTable dtCus
        )
        {
			dtCus = TDALUtils.DBUtils.GetTableContents(
                _dbCarSv // db
                , "Water_Customer" // strTableName
                , "top 1 *" // strColumnList
                , "" // strClauseOrderBy
				, "CusID", "=", strCusID // arrobjParamsTriple item
             );

			if (dtCus == null || dtCus.Rows.Count == 0)
            {

                throw CMyException.Raise(
                    TError.ErrITS.Its_Customer_Get
                    , null
                    , alParamsCoupleError.ToArray()
                    );
            }
        }
        #endregion
        #endregion


        #endregion

        #region //WaterCustomer

        #region Its_WaterCustomer_Get
		public DataSet Its_WaterCustomer_Get(
        string strGWUserCode
        , string strGWPassword
        , string strTid
        , string strPartnerCode
        , string strPartnerUserCode
        , string strLanguageCode
        , string strCusIDConditionList
        , string strCusCodeConditionList
        , string strCusNameConditionList
        , string strOrgNameConditionList
        , string strAddressConditionList
        )
        {

            #region // Temp:

            DataSet mdsFinal = CMyDataSet.NewMyDataSet(strTid);

            int nTidSeq = 0;
            bool bNeedTransaction = false;
			string strFunctionName = "Its_Customer_Get";
            string strErrorCodeDefault = TError.ErrITS.Its_Customer_Get;
            ArrayList alParamsCoupleError = new ArrayList(new object[]{

					"strFunctionName", strFunctionName
                    , "strCusIDConditionList", strCusIDConditionList
					, "strCusCodeConditionList", strCusCodeConditionList
					, "strCusNameConditionList", strCusNameConditionList
                    ,"strOrgNameConditionList",strOrgNameConditionList
                    , "strAddressConditionList",strAddressConditionList
					});

            #endregion

            try
            {

                #region // Init:

                _dbCarSv.AppUserID = strPartnerUserCode;

                if (bNeedTransaction) _dbCarSv.BeginTransaction();

                // Write request log:

                _log.WriteLogAsync(

                _strConfig_GwUserCode // strGwUserCodeForLog

                , _strConfig_GwUserPasswordForLog // strGwPasswordForLog

                , strTid // strAppTid

                , strPartnerCode // strAppServiceCode

                , strPartnerUserCode // strAppUPartCode

                , DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") // strAppTDateTime

                , TError.Error.NoError // strAppErrorCode

                , strFunctionName // strAppLogType1

                , "REQUEST" // strAppLogType2

                , "" // strAppLogType3

                , strLanguageCode // strAppLanguageCode

                , "" // strAppRemark

                , TUtils.CUtils.ParamsCouple2ParamsTriple(alParamsCoupleError, 1, "").ToArray() // arrobjParamsTriple

                );

                // Check Valid Tid:

                myUtils_ValidateId(

                ref alParamsCoupleError // alParamsCoupleError

                , strTid // strTid

                , TError.ErrITS.CommonInvalidTid // strErrCodeWhenInvalid

                );

                #endregion

                #region // Build Sql:

                ArrayList alParamsCoupleSql = new ArrayList();

                string strSqlGetData = @"
						SELECT
                               t.*
                        FROM Water_Customer t with (nolock)
						WHERE (1=1)
                                    zzzzClauseWhereCusIDConditionList
                                    zzzzClauseWhereCusCodeConditionList
									zzzzClauseWhereCusNameConditionList
									zzzzClauseWhereOrgNameConditionList
                                    zzzzClauseWhereAddressConditionList
									;
				";

				string zzzzClauseWhereCusIDConditionList = SqlUtils.BuildClause("and", "t.CusID", strCusIDConditionList, "@p", ref alParamsCoupleSql);
				string zzzzClauseWhereCusCodeConditionList = SqlUtils.BuildClause("and", "t.CusCode", strCusCodeConditionList, "@p", ref alParamsCoupleSql);
				string zzzzClauseWhereCusNameConditionList = SqlUtils.BuildClause("and", "t.CusName", strCusNameConditionList, "@p", ref alParamsCoupleSql);
				string zzzzClauseWhereOrgNameConditionList = SqlUtils.BuildClause("and", "t.OrgnName", strOrgNameConditionList, "@p", ref alParamsCoupleSql);
				string zzzzClauseWhereAddressConditionList = SqlUtils.BuildClause("and", "tp.Address", strAddressConditionList, "@p", ref alParamsCoupleSql);

                strSqlGetData = StringUtils.Replace(
                strSqlGetData
				, "zzzzClauseWhereCusIDConditionList", zzzzClauseWhereCusIDConditionList
				, "zzzzClauseWhereCusCodeConditionList", zzzzClauseWhereCusCodeConditionList
				, "zzzzClauseWhereCusNameConditionList", zzzzClauseWhereCusNameConditionList
				, "zzzzClauseWhereOrgNameConditionList", zzzzClauseWhereOrgNameConditionList
				, "zzzzClauseWhereAddressConditionList", zzzzClauseWhereAddressConditionList
                );

                #endregion

                #region // Get Data:
                myDebug_SaveSql(
                    _bDebugMode // bDebugMode
                    , ref alParamsCoupleError // alParamsCoupleError
                    , string.Format("strSql_{0}", strFunctionName) // strParamName
                    , strSqlGetData // strSql
                    );


                DataSet dsGetData = _dbCarSv.ExecQuery(

                strSqlGetData

                , alParamsCoupleSql.ToArray()

                );

                dsGetData.Tables[0].TableName = "Water_Customer";
            
                DataUtils.MoveDataTable(ref mdsFinal, ref dsGetData);

                #endregion

                // Return Good:

                TDALUtils.DBUtils.CommitSafety(_dbCarSv);

                mdsFinal.AcceptChanges();

                return mdsFinal;

            }

            catch (Exception exc)
            {

                #region // Catch of try:

                // Rollback:

                TDALUtils.DBUtils.RollbackSafety(_dbCarSv);

                // Return Bad:

                return TUtils.CProcessException.Process(

                ref mdsFinal

                , exc

                , strErrorCodeDefault
                , alParamsCoupleError.ToArray()

                );

                #endregion

            }

            finally
            {

                #region // Finally of try:

                // Rollback and Release resources:

                TDALUtils.DBUtils.RollbackSafety(_dbCarSv);

                TDALUtils.DBUtils.ReleaseAllSemaphore(_dbCarSv_Sys, true);

                TUtils.CProcessException.Process(

                ref mdsFinal // mdsFinal

                , _log // log

                , _strConfig_GwUserCode // strGwUserCodeForLog

                , _strConfig_GwUserPasswordForLog // strGwPasswordForLog

                , strFunctionName // strFunctionName

                , TUtils.CUtils.TidNext(strTid, ref nTidSeq) // strAppTid

                , DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") // strAppTDateTime

                , strPartnerCode // strAppServiceCode

                , strPartnerUserCode // strAppUserCode

                , strLanguageCode // strLanguageCode

                , "" // strRemark"

                );

                #endregion

            }

        }

        #endregion

        #region //Its_Water_Customer_Create
		public DataSet Its_Water_Customer_Create(
			 string strGWUserCode
			 , string strGWPassword
			 , string strTid
			 , string strPartnerCode
			 , string strPartnerUserCode
			 , string strLanguageCode
			 , string strCusCode
			 , string strCusName
			 , string strOrgName
			 , string strAddress
			 , string strCusTel
			 , string strDebit
			 , string strNote
			 , string strNoVoCurrent
			 , string strCuocVoCurrent
     )
        {
            #region // Temp:
            DataSet mdsFinal = CMyDataSet.NewMyDataSet(strTid);
            int nTidSeq = 0;
            bool bNeedTransaction = true;
			string strFunctionName = "Its_Customer_Create";
            string strErrorCodeDefault = TError.ErrITS.Its_Customer_Create;
            ArrayList alParamsCoupleError = new ArrayList(new object[]{
			"strFunctionName", strFunctionName
			, "strCusCode", strCusCode
			, "strCusName", strCusName
			, "strOrgName", strOrgName
			, "strAddress", strAddress
			, "strCusTel",strCusTel
			, "strDebit",strDebit
			, "strNote", strNote
			, "strNoVoCurrent", strNoVoCurrent
			, "strCuocVoCurrent", strCuocVoCurrent
});
            #endregion
            try
            {
                #region // Init:
                _dbCarSv.AppUserID = strPartnerUserCode;
                if (bNeedTransaction) _dbCarSv.BeginTransaction();
                // Write request log:
                _log.WriteLogAsync(
                _strConfig_GwUserCode // strGwUserCodeForLog
                , _strConfig_GwUserPasswordForLog // strGwPasswordForLog
                , strTid // strAppTid
                , strPartnerCode // strAppServiceCode
                , strPartnerUserCode // strAppUPartCode
                , DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") // strAppTDateTime
                , TError.Error.NoError // strAppErrorCode
                , strFunctionName // strAppLogType1
                , "REQUEST" // strAppLogType2
                , "" // strAppLogType3
                , strLanguageCode // strAppLanguageCode
                , "" // strAppRemark
                , TUtils.CUtils.ParamsCouple2ParamsTriple(alParamsCoupleError, 1, "").ToArray() // arrobjParamsTriple
                );
                // Check Valid Tid:
                myUtils_ValidateId(
                ref alParamsCoupleError // alParamsCoupleError
                , strTid // strTid
                , TError.ErrITS.CommonInvalidTid // strErrCodeWhenInvalid
                );
                #endregion

                #region // Check:

				//if (dsBookGuideDetail == null || dsBookGuideDetail.Tables.Count == 0)
				//{
				//    throw CMyException.Raise(
				//   TError.ErrITS.Its_BookingTour_NotFoundDetail
				//   , null
				//   , alParamsCoupleError.ToArray()
				//   );
				//}
				//else
				//{
				//    if (dsBookGuideDetail.Tables["BookGuideDetail"].Rows.Count == 0)
				//    {
				//        throw CMyException.Raise(
				//    TError.ErrITS.Its_BookGuide_NotFoundDetail
				//    , null
				//    , alParamsCoupleError.ToArray()
				//  );
				//    }
                //}
                #endregion

                #region // dt_Book:
                DataTable dt_Book = TDALUtils.DBUtils.GetSchema(_dbCarSv, "Water_Customer").Tables[0];
                dt_Book.Rows.Add(dt_Book.NewRow());
                dt_Book.Rows[0]["CusCode"] = strCusCode;
                if (!StringUtils.IsEmpty(strCusName))
                {
                    dt_Book.Rows[0]["CusName"] = strCusName;
                }

                if (!StringUtils.IsEmpty(strOrgName))
                {
					dt_Book.Rows[0]["OrgName"] = strOrgName;
                }

                if (!StringUtils.IsEmpty(strAddress))
                {
					dt_Book.Rows[0]["Address"] = strAddress;
                }

                if (!StringUtils.IsEmpty(strCusTel))
                {
					dt_Book.Rows[0]["CusTel"] = strCusTel;
                }
				if (!StringUtils.IsEmpty(strDebit))
				{
					dt_Book.Rows[0]["Debit"] = strDebit;
				}
				if (!StringUtils.IsEmpty(strNoVoCurrent))
				{
					dt_Book.Rows[0]["NoVoCurrent"] = strNoVoCurrent;
				}
				if (!StringUtils.IsEmpty(strCuocVoCurrent))
				{
					dt_Book.Rows[0]["CuocVoCurrent"] = strCuocVoCurrent;
				}
				
				dt_Book.Rows[0]["IsActive"] = "1";
				
                if (!StringUtils.IsEmpty(strNote))
                {
                    dt_Book.Rows[0]["NOTE"] = strNote;
                }

                //Save
				_dbCarSv.SaveData("Water_Customer", dt_Book);

                //Get ID
                string strSqlGetTourID = @"select @@Identity CusID;";
                Int32 iID = Convert.ToInt32(_dbCarSv.ExecQuery(strSqlGetTourID).Tables[0].Rows[0][0]);
				dt_Book.Rows[0]["CusID"] = iID;
                #endregion
                #region // Return data

				DataSet dsGetData = new DataSet();
                dsGetData.Tables.Add(dt_Book.Copy());
				dsGetData.Tables[0].TableName = "Water_Customer";

                DataUtils.MoveDataTable(ref mdsFinal, ref dsGetData);

                #endregion

                // Return Good:
                TDALUtils.DBUtils.CommitSafety(_dbCarSv);
                mdsFinal.AcceptChanges();
                return mdsFinal;
            }
            catch (Exception exc)
            {
                #region // Catch of try:
                // Rollback:
                TDALUtils.DBUtils.RollbackSafety(_dbCarSv);
                // Return Bad:
                return TUtils.CProcessException.Process(
                ref mdsFinal
                , exc
                , strErrorCodeDefault
                , alParamsCoupleError.ToArray()
                );
                #endregion
            }
            finally
            {
                #region // Finally of try:
                // Rollback and Release resources:
                TDALUtils.DBUtils.RollbackSafety(_dbCarSv);
                TDALUtils.DBUtils.ReleaseAllSemaphore(_dbCarSv_Sys, true);
                TUtils.CProcessException.Process(
                ref mdsFinal // mdsFinal
                , _log // log
                , _strConfig_GwUserCode // strGwUserCodeForLog
                , _strConfig_GwUserPasswordForLog // strGwPasswordForLog
                , strFunctionName // strFunctionName
                , TUtils.CUtils.TidNext(strTid, ref nTidSeq) // strAppTid
                , DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") // strAppTDateTime
                , strPartnerCode // strAppServiceCode
                , strPartnerUserCode // strAppUserCode
                , strLanguageCode // strLanguageCode
                , " // strRemark"
                );
                #endregion
            }
        }

        #endregion

		#region //Its_Water_Customer_Update
		public DataSet Its_Water_Customer_Update(
     string strGWUserCode
     , string strGWPassword
     , string strTid
     , string strPartnerCode
     , string strPartnerUserCode
     , string strLanguageCode
			, string strCusID
			, string strCusCode
			 , string strCusName
			 , string strOrgName
			 , string strAddress
			 , string strCusTel
			 , string strDebit
			 , string strNote
			 , string strNoVoCurrent
			 , string strCuocVoCurrent
     )
        {
            #region // Temp:
            DataSet mdsFinal = CMyDataSet.NewMyDataSet(strTid);
            int nTidSeq = 0;
            bool bNeedTransaction = true;
			string strFunctionName = "Its_Water_Customer_Update";
			string strErrorCodeDefault = TError.ErrITS.Its_Customer_Update;
            ArrayList alParamsCoupleError = new ArrayList(new object[]{
			"strFunctionName", strFunctionName
			,"strCusID",strCusID
			, "strCusCode", strCusCode
			, "strCusName", strCusName
			, "strOrgName", strOrgName
			, "strAddress", strAddress
			, "strCusTel",strCusTel
			, "strDebit",strDebit
			, "strNote", strNote
			, "strNoVoCurrent", strNoVoCurrent
			, "strCuocVoCurrent", strCuocVoCurrent
});
            #endregion
            try
            {
                #region // Init:
                _dbCarSv.AppUserID = strPartnerUserCode;
                if (bNeedTransaction) _dbCarSv.BeginTransaction();
                // Write request log:
                _log.WriteLogAsync(
                _strConfig_GwUserCode // strGwUserCodeForLog
                , _strConfig_GwUserPasswordForLog // strGwPasswordForLog
                , strTid // strAppTid
                , strPartnerCode // strAppServiceCode
                , strPartnerUserCode // strAppUPartCode
                , DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") // strAppTDateTime
                , TError.Error.NoError // strAppErrorCode
                , strFunctionName // strAppLogType1
                , "REQUEST" // strAppLogType2
                , "" // strAppLogType3
                , strLanguageCode // strAppLanguageCode
                , "" // strAppRemark
                , TUtils.CUtils.ParamsCouple2ParamsTriple(alParamsCoupleError, 1, "").ToArray() // arrobjParamsTriple
                );
                // Check Valid Tid:
                myUtils_ValidateId(
                ref alParamsCoupleError // alParamsCoupleError
                , strTid // strTid
                , TError.ErrITS.CommonInvalidTid // strErrCodeWhenInvalid
                );
                #endregion

                #region // Check:
                DataTable dt_Book = null;
                this.CheckExistCusID(
                    ref alParamsCoupleError
                    , strCusID
                    , out dt_Book
                    );
                #endregion

                #region // dt_Book:
                ArrayList alColumnEffective = new ArrayList();
                alColumnEffective.Clear();

				dt_Book.Rows[0]["CusCode"] = strCusCode; alColumnEffective.Add("CusCode");
				if (!StringUtils.IsEmpty(strCusName))
				{
					dt_Book.Rows[0]["CusName"] = strCusName; alColumnEffective.Add("CusName");
				}

				if (!StringUtils.IsEmpty(strOrgName))
				{
					dt_Book.Rows[0]["OrgName"] = strOrgName; alColumnEffective.Add("OrgName");
				}

				if (!StringUtils.IsEmpty(strAddress))
				{
					dt_Book.Rows[0]["Address"] = strAddress; alColumnEffective.Add("Address");
				}

				if (!StringUtils.IsEmpty(strCusTel))
				{
					dt_Book.Rows[0]["CusTel"] = strCusTel; alColumnEffective.Add("CusTel");
				}
				if (!StringUtils.IsEmpty(strDebit))
				{
					dt_Book.Rows[0]["Debit"] = strDebit; alColumnEffective.Add("Debit");
				}
				if (!StringUtils.IsEmpty(strNoVoCurrent))
				{
					dt_Book.Rows[0]["NoVoCurrent"] = strNoVoCurrent; alColumnEffective.Add("NoVoCurrent");
				}
				if (!StringUtils.IsEmpty(strCuocVoCurrent))
				{
					dt_Book.Rows[0]["CuocVoCurrent"] = strCuocVoCurrent; alColumnEffective.Add("CuocVoCurrent");
				}

				//dt_Book.Rows[0]["IsActive"] = "1";

				if (!StringUtils.IsEmpty(strNote))
				{
					dt_Book.Rows[0]["NOTE"] = strNote; alColumnEffective.Add("NOTE");
				}

                //Save
                _dbCarSv.SaveData("Water_Customer", dt_Book, alColumnEffective.ToArray());

                //Get ID
                Int32 iID = Convert.ToInt32(strCusID);
                #endregion

                

                #region // Return data
          

                //Return data
				DataSet dsGetData = new DataSet();
                dsGetData.Tables.Add(dt_Book.Copy());
				dsGetData.Tables[0].TableName = "Water_Customer";

                DataUtils.MoveDataTable(ref mdsFinal, ref dsGetData);

                #endregion

                // Return Good:
                TDALUtils.DBUtils.CommitSafety(_dbCarSv);
                mdsFinal.AcceptChanges();
                return mdsFinal;
            }
            catch (Exception exc)
            {
                #region // Catch of try:
                // Rollback:
                TDALUtils.DBUtils.RollbackSafety(_dbCarSv);
                // Return Bad:
                return TUtils.CProcessException.Process(
                ref mdsFinal
                , exc
                , strErrorCodeDefault
                , alParamsCoupleError.ToArray()
                );
                #endregion
            }
            finally
            {
                #region // Finally of try:
                // Rollback and Release resources:
                TDALUtils.DBUtils.RollbackSafety(_dbCarSv);
                TDALUtils.DBUtils.ReleaseAllSemaphore(_dbCarSv_Sys, true);
                TUtils.CProcessException.Process(
                ref mdsFinal // mdsFinal
                , _log // log
                , _strConfig_GwUserCode // strGwUserCodeForLog
                , _strConfig_GwUserPasswordForLog // strGwPasswordForLog
                , strFunctionName // strFunctionName
                , TUtils.CUtils.TidNext(strTid, ref nTidSeq) // strAppTid
                , DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") // strAppTDateTime
                , strPartnerCode // strAppServiceCode
                , strPartnerUserCode // strAppUserCode
                , strLanguageCode // strLanguageCode
                , " // strRemark"
                );
                #endregion
            }
        }

        #endregion

		#region // Its_Water_Customer_Delete
		public DataSet Its_Water_Customer_Delete(
            string strGwUserCode
            , string strGwPassword
            , string strTid
            , string strPartnerCode
            , string strPartnerUserCode
            , string strLanguageCode
            , string strCusID
        )
        {
            #region // temp
            DataSet mdsFinal = CMyDataSet.NewMyDataSet(strTid);
            int nTidSeq = 0;
            bool bNeedTransaction = true;
			string strFunctionName = "Its_Customer_Delete";
            string strErrorCodeDefault = TError.ErrITS.Its_Customer_Delete;
            ArrayList alParamsCoupleError = new ArrayList(new object[]{
					"strFunctionName", strFunctionName
                   ,"strCusID",strCusID 
					});
            #endregion

            try
            {
                #region // Init:
                _dbCarSv.AppUserID = strPartnerUserCode;
                if (bNeedTransaction) _dbCarSv.BeginTransaction();

                // Write request log:
                _log.WriteLogAsync(
                    _strConfig_GwUserCode // strGwUserCodeForLog
                    , _strConfig_GwUserPasswordForLog // strGwPasswordForLog
                    , strTid // strAppTid
                    , strPartnerCode // strAppServiceCode
                    , strPartnerUserCode // strAppUserCode
                    , DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") // strAppTDateTime
                    , TError.Error.NoError // strAppErrorCode
                    , strFunctionName // strAppLogType1
                    , "REQUEST" // strAppLogType2
                    , "" // strAppLogType3
                    , strLanguageCode // strAppLanguageCode
                    , "" // strAppRemark
                    , TUtils.CUtils.ParamsCouple2ParamsTriple(alParamsCoupleError, 1, "").ToArray() // arrobjParamsTriple
                    );

                // Check Valid Tid:
                myUtils_ValidateId(
                    ref alParamsCoupleError // alParamsCoupleError
                    , strTid // strTid
                    , TError.ErrHTC.CommonInvalidTid // strErrCodeWhenInvalid
                    );
                #endregion

                #region //Customer
                #region //Check
                DataTable dt_Book = null;
                this.CheckExistCusID(
                     ref alParamsCoupleError
                    , strCusID
                    , out dt_Book
                 );

                #endregion

                #region // Save data
                string strSqlDelete = @"
						delete 
						from Water_Customer
						where
							CusID = @strCusID
						;
					";

                // Save:
                myDebug_SaveSql(
                    _bDebugMode // bDebugMode
                    , ref alParamsCoupleError // alParamsCoupleError
                    , string.Format("strSql_{0}", strFunctionName) // strParamName
                    , strSqlDelete // strSql
                    );
                _dbCarSv.ExecQuery(
                    strSqlDelete
					, "@strCusID", strCusID
                    );



                #endregion
                #endregion

                // Return Good:
                TDALUtils.DBUtils.CommitSafety(_dbCarSv);
                mdsFinal.AcceptChanges();
                return mdsFinal;
            }
            catch (Exception exc)
            {
                #region // Catch of try:
                // Rollback:
                TDALUtils.DBUtils.RollbackSafety(_dbCarSv);

                // Return Bad:
                return TUtils.CProcessException.Process(
                    ref mdsFinal
                    , exc
                    , strErrorCodeDefault
                    , alParamsCoupleError.ToArray()
                    );
                #endregion
            }
            finally
            {
                #region // Finally of try:
                // Rollback and Release resources:
                TDALUtils.DBUtils.RollbackSafety(_dbCarSv);
                TDALUtils.DBUtils.ReleaseAllSemaphore(_dbCarSv_Sys, true);

                TUtils.CProcessException.Process(
                    ref mdsFinal // mdsFinal
                    , _log // log
                    , _strConfig_GwUserCode // strGwUserCodeForLog
                    , _strConfig_GwUserPasswordForLog // strGwPasswordForLog
                    , strFunctionName // strFunctionName
                    , TUtils.CUtils.TidNext(strTid, ref nTidSeq) // strAppTid
                    , DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") // strAppTDateTime
                    , strPartnerCode // strAppServiceCode
                    , strPartnerUserCode // strAppUserCode
                    , strLanguageCode // strLanguageCode
                    , "" // strRemark
                    );
                #endregion
            }
        }
        #endregion

        #endregion
        
    }
}
